package JDBC;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

public class Stage_Supprimer {

	public void supprimer(ArrayList<String> listeIdStage)
	{
		try 
		{	

			connexionBDD a = new connexionBDD();
			Connection conn=a.connect();

			Statement state = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

			for(String idStage : listeIdStage)
			{
				Statement state1 = conn.createStatement();
				Statement state2 = conn.createStatement();
				state2.executeUpdate("DELETE FROM eleves_stage WHERE id_stage="+idStage);
				state2.close();
				state1.executeUpdate("DELETE FROM stage WHERE id_stage="+idStage);
				state1.close();	
				state.close();
			}
		} 
	
		catch (Exception e) 
		{
			e.printStackTrace();
		}	
	}
}
